﻿@model Web.ViewModels.OrderDetailViewModel

@{
    ViewBag.Title = "OrderDetail";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>OrderDetail</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>OrderDetailViewModel</legend>
          
       <fieldset>
        <legend>Order</legend>

        <div class="editor-label">
         Номер заказа
        </div>
         <div class="editor-label">
            @Html.DisplayFor(model=>model.order.Id)
        </div>    

             <div class="editor-label">
            @Html.LabelFor(model => model.order.OrderDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.OrderDate)
            @Html.ValidationMessageFor(model => model.order.OrderDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Username)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Username)
            @Html.ValidationMessageFor(model => model.order.Username)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.FirstName)
            @Html.ValidationMessageFor(model => model.order.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.LastName)
            @Html.ValidationMessageFor(model => model.order.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.MiddleName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.MiddleName)
            @Html.ValidationMessageFor(model => model.order.MiddleName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Address)
            @Html.ValidationMessageFor(model => model.order.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.City)
            @Html.ValidationMessageFor(model => model.order.City)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.State)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.State)
            @Html.ValidationMessageFor(model => model.order.State)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.PostalCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.PostalCode)
            @Html.ValidationMessageFor(model => model.order.PostalCode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Country)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Country)
            @Html.ValidationMessageFor(model => model.order.Country)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Phone)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Phone)
            @Html.ValidationMessageFor(model => model.order.Phone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Email)
            @Html.ValidationMessageFor(model => model.order.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.order.Total)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.order.Total)
            @Html.ValidationMessageFor(model => model.order.Total)
        </div>

           <div class="editor-label">
               @Html.DropDownList("OrderStatusId")
        
           </div>
     
    </fieldset>
        
           </fieldset>
    <table>
    <tr>
        
        <th>
            ProduceInPackageId
        </th>
        <th>
            Quantity
        </th>
        <th>
            UnitPrice
        </th>
        <th></th>
    </tr>

@foreach (var item in Model.orderDetails)
{
    <tr>
        @Html.HiddenFor(model => item.Id)
        @Html.HiddenFor(model => item.OrderId)

        <td>
            @Html.DisplayFor(modelItem => item.ProduceInPackageId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Quantity)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UnitPrice)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new {id = item.Id}) |
            @Html.ActionLink("Details", "Details", new {id = item.Id}) |
            @Html.ActionLink("Delete", "Delete", new {id = item.Id})
        </td>
    </tr>


}
        </table>    

        <p>
            <input type="submit" value="Save" />
        </p>
 
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
